﻿/*
 * DataReceivedEventArgs
 * 
 * Author: snowdreamist
 * Date: 2011/12/3
 * 
 */

using System;
using System.Collections.Generic;
using System.Net;
using System.Linq;
using System.Text;

namespace BitTorrentSharp.KRPC.Network
{
    public class DataReceivedEventArgs : EventArgs
    {
        public DataReceivedEventArgs(byte[] data, IPEndPoint remoteEndPoint)
        {
            if (data == null)
                throw new ArgumentNullException("data");
            if (remoteEndPoint == null)
                throw new ArgumentNullException("remoteEndPoint");
            this._data = data;
            this.RemoteEndPoint = remoteEndPoint;
        }

        public IPEndPoint RemoteEndPoint { get; private set; }

        public byte[] GetData()
        {
            byte[] copiedData = new byte[this._data.Length];
            this._data.CopyTo(copiedData, 0);
            return copiedData;
        }

        #region private

        private byte[] _data;

        #endregion
    }
}
